package drag.and.drop;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;

public class DrawView extends View {

    Paint paint1 = new Paint();
    Paint paint2 = new Paint();
    String id;
    int coordx, coordy;
    
    public DrawView(Context context, String id,int coordx, int coordy) {
        super(context);
        
        this.id = id;
        this.coordx = coordx;
        this.coordy = coordy;
        setFocusable(true);
        paint1.setColor(Color.WHITE);
        paint1.setAntiAlias(true); 
        paint2.setColor(Color.WHITE);
        paint2.setAntiAlias(true);
    }
    
    public DrawView(Context context, String id,int coordx, int coordy, int temp) {
        super(context);
        
        this.id = id;
        this.coordx = coordx;
        this.coordy = coordy;
        setFocusable(true);
        if(temp>300)
        	paint1.setColor(Color.RED);
        else
        	paint1.setColor(Color.WHITE);
        paint1.setAntiAlias(true); 
        paint2.setColor(Color.WHITE);
        paint2.setAntiAlias(true);
    }

    @Override
    public void onDraw(Canvas canvas) {
    	canvas.drawRect(coordx, coordy, coordx+30, coordy+30, paint1);
    	canvas.drawText(id+"", coordx-3, coordy+43, paint2);
    	canvas.scale(coordx, coordy, coordx+50, coordy+50);
    }
    

 
}





